function promisfy(fn) {
    return function (...args) {
        return new Promise(function (resolve, reject) {
            args.push(function (err, data) {
                if (err) {
                    reject(err)
                } else {
                    resolve(data)
                }
            })
            fn.apply(this, args)
        })
    }
}